<template>

    <masonry-table :data-source="tableList">
        <!--<template slot="header">-->
          <!---->
        <!--</template>-->
        <template slot="body" slot-scope="props">
            <div class="col-md-2">
            <div class="ibox">
                <div class="ibox-content product-box active">
                    <div class="product-imitation center-block">
                        <a  target="_blank" :href="props.item.videoPath">
                        <video height="150px" :src="props.item.videoPath"></video>
                        </a>
                    </div>
                    <div class="product-desc ">
                        <a href="javascript:;"  class="product-name content-title"> {{props.item.videoTitle}}</a>
                        <div class="m-t text-righ">
                            <button type="button" v-on:click="showEditDialog(props.item.id)" class="btn btn-xs btn-outline btn-primary"><i class="fa fa-pencil"></i> 修改</button>

                            <button type="button" v-on:click="showDeleteDialog(props.item.id)" class="btn btn-xs btn-outline btn-primary"><i class="fa fa-trash"></i> 删除</button>
                        </div>
                    </div>
                </div>
            </div>
            </div>
        </template>
    </masonry-table>
</template>
<style scoped>
    .grid .ibox {
        margin-bottom: 0;
    }
    video{
        width: 100% !important;
        height:120px !important;
    }
    .content-title{
        max-width: 80%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .product-imitation {
        text-align: center;
        padding: 0;
        background-color: #f8f8f9;
        color: #bebec3;
        font-weight: 600;
    }
</style>
<script>
    export default {
        props: {
            stateManager: {
                type: Object
            }
        },
        data: function () {
            return {
                list: this.$listDataSource({
                    url: 'api/WeChat/WeChatVideo',
                })
            };
        },
        methods: {
            showDialog: function (uuid) {
                this.stateManager.SeeDialogVisible = true;
                this.stateManager.SeeModelId = uuid;
            },
            showEditDialog: function (uuid) {
                //console.log(uuid);
                this.stateManager.editModelId = uuid;
                this.stateManager.editDialogVisible = true;

            },
            showDeleteDialog: function (uuid) {
                this.stateManager.deleteDialogVisible = true;
                this.stateManager.deleteModelId = uuid;
            },
        },
        computed: {
            user(){
                return this.$store.state.user;
            },
            tableList(){
                if (this.stateManager.refreshList) {
                    this.list.fetch();
                    this.stateManager.refreshList = false;
                }
                return this.list;
            }
        }
    }
</script>